F/OSS Comics

12. BSD Unix, Part 2 - The Birth of the vi Editor

Posted on Oct 11, 2026

In 1975, Ken Thompson returned to his alma mater, UC Berkeley, for a sabbatical as a visiting professor. He was getting Unix Version 6 running on the new PDP-11/70.[2]

That's Ken Thompson. He created Unix. Maybe we can help.

Who are those two? They've been following me for days.

The PDP-11/70 machine room.

Professor, can we help?

There you are.

Ha! Plenty to do.

I'm improving a Pascal interpreter. Want to help?

Sure!

Their improvements made the Pascal system faster to compile and run. It became a favorite among students.[2]

The birth of vi

Unix came with ed, a line editor Thompson had written in 1969 during Unix's early development.[4]

Isn't ed awkward to use?

Ha! Made for teletypes. Still works for me...

Wait... how do you edit a document with ed?

Here is a short ed session. Commands, typed text, and output appear together. The $ prompts belong to the shell; ed itself normally has no prompt.

$ ed
a
ed is the standard Unix text editor.
This is line number one.
.
,p
ed is the standard Unix text editor.
This is line number one.
2s/one/two/
,p
ed is the standard Unix text editor.
This is line number two.
w text
62
q
$ cat text
ed is the standard Unix text editor.
This is line number two.

The a command starts appending text. A period on a line by itself ends input. The command ,p prints every line in the buffer.

To change one to two on the second line, you enter 2s/one/two/. Instead of moving a cursor over the text, you specify the line and the substitution. Then w text saves the buffer to a file named text, reporting its size in bytes, and q quits.

The resulting file contains:

ed is the standard Unix text editor.
This is line number two.

In the 1960s, memory was scarce and modems were slow. Many terminals printed onto paper rather than displaying text on a screen. A terse editor made sense in that setting.[4]

A yellow Teletype Model 33 with a keyboard and paper roll.

The Teletype Model 33, a widely used printing terminal.

By the 1970s, terminals with CRT screens were becoming common. Unix users were still editing with ed.

We have a screen. Why edit like this?

One day...

Bill! George Coulouris from Queen Mary College is visiting. His em editor lets you edit a line on screen.

That's what I need.

Here's the em source tape. It'll show you how it handles a video terminal.

Thanks, Professor.

Joy and Haley built on em to develop ex. By October 1977, Joy had added the full-screen visual mode that became vi.[2][3]

I'll add em's editing code to ed and build a full-screen visual mode. I'll call it ex.

Coding's a lot more fun in visual mode.

The visual mode proved popular with BSD users. Invoking the editor as vi eventually became a way to start directly in that mode. The underlying ex command mode is still part of vi.[3]

The West Coast Unix Users Group

Thompson also shared his knowledge of Unix. At early meetings of the West Coast Unix Users Group, he walked participants through the kernel source, line by line, over a series of evenings.[1]

Did everyone bring the Unix source?

Too long!

That habit of sharing code and explaining how it worked would carry through BSD into the broader free and open source software community.

Goodbye, Professor!

Back to Bell Labs. Happy hacking!

References

  1. Andrew Leonard, BSD Unix: Power to the people, from the code, 2000.
  2. Marshall Kirk McKusick, Twenty Years of Berkeley Unix, in Open Sources: Voices from the Open Source Revolution, 1999. The Korean edition, referenced in the original comic, was published by Hanbit Media in 2013.
  3. vi (text editor), Wikipedia.
  4. ed (text editor), Wikipedia.